home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 37
/
Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso
/
Aminet
/
dev
/
misc
/
TCS.lha
/
TCS
/
examples
/
sources
/
TriBuf&Zm.s
< prev
next >
Wrap
Text File
|
2000-04-13
|
5KB
|
176 lines
*******************************************************************************
* triple buffering & zoom example
*******************************************************************************
* INFO loads a 320x256x8 ILBM and then zooms it in onto a triple
* buffered FullRes screen
* NOTE - optionally you can pass as CLI argument the names of the
* 320x256x8 IFF/ILBMs to load (if not one of those supplied in
* TCS/examples/pix/, make sure that yours is exactly 320x256x8
* and that it respects all the restrictions of TCS_LdILBM(),
* otherwise the program won't execute or the graphics will
* look bad - not dangerous, anyway!)
* - LMB to exit anytime
*******************************************************************************
machine 68020
include INCLUDES:libraries/tcs.i
include INCLUDES:libraries/tcs_lib.i
*******************************************************************************
* custom display & other definitions
*******************************************************************************
DSPLWD = 320 ;our TCS display width and
DSPLHT = 256 ;height in 140 ns pixels
SCRWD = 320 ;TCS screen width and
SCRHT = 256 ;height in pixels
DSPLX0 = $81*4 ;display start
DSPLY0 = $2c ;position (SHRES pixels)
DSPLX1 = DSPLX0+DSPLWD*4 ;display end
DSPLY1 = DSPLY0+DSPLHT ;position (SHRES pixels)
DSPLBRTNS = 256 ;max brightness
GFXCTXT = 0
CWBTM = 0
CWTOP = 0
CWRT = 0
CWLF = 0
VDOMODE set TCS_VM_RGBW | TCS_VMf_FullRes ;TCS display video mode
VDOMODE set VDOMODE | TCS_VMf_TriBuf
ARGSNO = 1 ;command line arguments no.
STP = 2 ;zoom step (multiple of 2)
TXTRWD = DSPLWD ;source texture has the
TXTRHT = DSPLHT ;same dimensions of display
ifgt SCRWD-SCRHT
DF = SCRHT/2
else
DF = SCRWD/2
endif
LPS = DF/STP ;numbers of loops to perform
*******************************************************************************
* code start
*******************************************************************************
include /includes/macros.i
include /includes/shl_strtup.i
*******************************************************************************
* init
*******************************************************************************
_PrgInit movea.l CmdLnArgs,a0 ;ILBM filename address
tst.l a0
bne.s .ld ;if filename specified...
lea.l PicFlNm,a0 ;default ILBM
.ld suba.l a1,a1 ;to separate buffer
CALLTCS LdILBM ;load it
cmpi.l #TCS_PE_OK,d0 ;success?
blo.s .fail ;if not...
move.l d0,ILBMStrcAdr ;else store its ILBM structure address
movea.l DIAdr,a0 ;our display
move.b (TCS_II_RGBxMode.w,d0.l),d0 ;get ILBM0's RGBx mode
move.w #256,d1 ;max brightness
CALLTCS SetRGBx ;set appropriate palette
move.w #0,ccr ;OK!
rts
.fail move.w #4,ccr ;signal error
rts
*******************************************************************************
* main
*******************************************************************************
_PrgMain move.l #TriBufHndlr,([_VBR.l],$6c.w) ;set level3 autovector
move.w #$c020,$dff09a ;set INTENA.VERTB
movea.l ([ILBMStrcAdr.l],TCS_II_GfxAdr.w),a3 ;texture address
lea.l ZmStrc,a2 ;info about the zoom areas
move.w #LPS-1,d6 ;loops counter
.lp subq.w #STP,(8,a2) ;enlarge
subq.w #STP,(10,a2) ;the destination
addq.w #STP,(12,a2) ;area
addq.w #STP,(14,a2) ;on the screen
movea.l DIAdr,a0 ;our display
movea.l a3,a1 ;texture address
move.w #TXTRWD,d0 ;texture width
CALLTCS FitTxtr4 ;zoom in!
movea.l DIAdr,a0 ;render FullRes
move.w (8,a2),d0 ;screen to make
move.w (10,a2),d1 ;changes visible
move.w (12,a2),d2 ;(for speed-up,
move.w (14,a2),d3 ;only the area
move.w d0,d4 ;written by
move.w d1,d5 ;FitTxtr4()
CALLTCS CPUFRPass2 ;is updated)
movea.l DIAdr,a0 ;acknowledge screen
CALLTCS TriUpd ;rendering completion
btst.b #6,$bfe001
dbeq.s d6,.lp ;if not LMB...
WTLMB
rts
*******************************************************************************
* cleanup
*******************************************************************************
_PrgClnUp movea.l ILBMStrcAdr,a0 ;free all the memory
CALLTCS UnLdILBM ;allocated for the ILBM
rts
*******************************************************************************
* triple buffer handler (level 3 interrupt handler)
*******************************************************************************
TriBufHndlr btst.b #5,$dff01f
beq.s .exit ;if not INTREQR.VERTB...
movem.l d0-d1/a0-a1/a6,-(sp)
movea.l DIAdr,a0
CALLTCS TriSwp ;swap screen buffers
movem.l (sp)+,d0-d1/a0-a1/a6
.exit move.w #$70,$dff09c ;clr INTREQ.BLIT/VERTB/COPER
rte
*******************************************************************************
* data
*******************************************************************************
include /includes/dat.i
cnop 0,4
ZmStrc dc.w 0,0 ;source
dc.w TXTRWD-1,TXTRHT-1 ;area
dc.w DF,DF ;destination
dc.w SCRWD-DF-1,SCRHT-DF-1 ;area
ILBMStrcAdr dc.l 0 ;ILBM structure pointer
tmplt dc.b "ILBM/K",0 ;template for ReadArgs()
PicFlNm dc.b "/pix/TM_rgbm.iff",0 ;default ILBM